<?php

namespace app\backend\controller;

use app\common\Auth;
use think\Controller;
use think\Request;

class Base extends Controller
{
    /**
     * Base constructor.
     * @param Auth $auth
     * @param Request|null $request
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function __construct(Auth $auth, Request $request = null)
    {
        parent::__construct($request);
        if(!$auth->get()){
            $this->redirect(url("/admin/login"));
        }
    }
}
